package com.megan.design.principle.openclose;

import lombok.extern.slf4j.Slf4j;

/**
 * @Author: megan
 * @Data: 2018/8/19 上午10:38
 * @Description:
 */
@Slf4j
public class Test {

    public static void main(String[] args) {
        // 原价
        ICourse iCourse = new JavaCourse(66, "java入门指南", 218d);
        log.info("课程ID:{},课程名称：{}，课程价格：{}元", iCourse.getId(), iCourse.getName(), iCourse.getPrice());
        // 打折价格
        ICourse javaDiscountICourse = new JavaDiscountCourse(66, "java入门指南", 218d);
        JavaDiscountCourse javaDiscountCourse = (JavaDiscountCourse) javaDiscountICourse;
        log.info("打折 -> 课程ID:{},课程名称：{}，课程打折后价格：{}元，原价{}元", javaDiscountICourse.getId(), javaDiscountICourse.getName(), javaDiscountICourse.getPrice(), javaDiscountCourse.getDiscountPrice());
    }

}
